package edu.sctu.practice.class02.renzhaoxu.test03;

/**
 * Created by Administrator on 2015/10/15.
 */
public class MyTime {
    private int hour;
    private int minute;
    private int second;

    public MyTime(int hour, int minute, int second) {

        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    void display() {

        System.out.println("时间" + hour + ":" + minute + ":" + second);
    }

    void addSecond(int sec) {
        second = second + sec;
    }

    void addMinute(int min) {
        minute = minute + min;
    }

    void addHour(int hou) {
        hour = hour + hou;
    }

    void subSecond(int sec) {
        second = second - sec;
    }

    void subMinute(int min) {
        minute = minute - min;
    }

    void subHour(int hou) {
        hour = hour - hou;
    }

    void Test() {
        if (hour <= 23 & hour >= 0 & minute <= 59 & minute >= 0 & second <= 59 & second >= 0)
            System.out.println("\nTrue\n");
        else System.out.println("\nFalse\n");
    }



    public static void main(String args[]) {
        MyTime b = new MyTime(11, 4, 55);
        b.subHour(5);
        b.subMinute(5);
        b.subSecond(2);
        b.display();
        b.Test();

    }
}


